import * as BABYLON from "babylonjs"; //全部引入

// 添加车   添加外部模型车，设置材质太麻烦，暂未使用
function addCar(scene) {
  BABYLON.SceneLoader.ImportMesh(
    "",
    "static/model/car/",
    "carLow.obj",
    scene,
    newMeshes => {
      console.log(newMeshes, "抗");
      const car = BABYLON.Mesh.MergeMeshes(newMeshes.slice(0, 12));
      const carInsideWhell = BABYLON.Mesh.MergeMeshes(newMeshes.slice(12, 13));
      console.log(newMeshes.slice(12, 13), "让我看卡");
      let cIWMat = new BABYLON.StandardMaterial("cIWMat", scene);
      cIWMat.diffuseColor = new BABYLON.Color3.White();
      carInsideWhell.material = cIWMat;
      let carboyMat = new BABYLON.StandardMaterial("carBoyMat", scene);
      carboyMat.diffuseColor = new BABYLON.Color3.Red();
      car.material = carboyMat;
      car.position = new BABYLON.Vector3(0, 2, 0);
      // drone.scaling = new BABYLON.Vector3(0.6, 0.6, 0.6);

      console.log(car, "22");
    }
  );
}
export default addCar;
